home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2001 October / macformat-108.iso / Shareware / Math scientific / PsyScript / libraries / RB.lib / RB.lib.rsrc / TEXT_2000_Source Text.txt < prev    next >
Encoding:
Text File  |  2001-04-07  |  1.4 KB  |  30 lines

  1. property stimList : {"%", "$", "@", "?", "&", "^", ">", "<", "("} --the list of mask characters
  2.  
  3. set listHandler to load script ""
  4. to createMaskStimuli(howmany) --returns a list of mask words
  5.     set maskListOut to {} --will contain a list of mask strings
  6.     set theMaskCharacters to sample(howmany, stimList, false) of listHandler --grab 7 unique mask characters    
  7.     repeat with aMaskCharacter in theMaskCharacters --pad each mask character out to a length between 3 and 7 repeats
  8.         set theMaskString to ""
  9.         repeat with n from 1 to (random number from 3 to 7)
  10.             set theMaskString to theMaskString & aMaskCharacter
  11.         end repeat
  12.         set end of maskListOut to ("'" & theMaskString & "'") --single quotes so it is not interpreted as an instruction
  13.     end repeat
  14.     return maskListOut
  15. end createMaskStimuli
  16.  
  17. to packMaskLengthToPreceedingWord(WordStimuli, wordIndex, maskList, maskIndex)
  18.     set minlength to count of characters of item wordIndex of WordStimuli
  19.     set theCharString to text 2 through -2 of item maskIndex of maskList --step over quote
  20.     set maskLength to count of theCharString
  21.     if maskLength < minlength then
  22.         set theMaskCharacter to character 1 of theCharString
  23.         repeat with n from 1 to (minlength - maskLength)
  24.             set theCharString to theCharString & theMaskCharacter
  25.         end repeat
  26.     end if
  27.     set item maskIndex of maskList to "'" & theCharString & "'"
  28.     return maskList
  29. end packMaskLengthToPreceedingWord
  30.